package edu.umb.cs.antmanager.manager;

import java.util.Date;

import edu.umb.cs.antmanager.domain.TestType;

/**
 * Java bean used to store test related information
 * 
 * @author 2009CS682-3UMB_AntManager
 * 
 */
public class TestInfo {

	private TestType test;
	private String agentName;

	/**
	 * Test Status
	 * 
	 * @author 2009CS682-3UMB_AntManager
	 * 
	 */
	public static enum TestStatus {
		UNTESTED, RUNNING, FINISHED
	};

	private TestStatus status;
	private Date startTime;
	private Date endTime;
	private boolean warn;
	private boolean error;

	/**
	 * Initiate a new Test
	 * 
	 * @param t
	 *            The test
	 */
	public TestInfo(TestType t) {
		this.test = t;
		status = TestStatus.UNTESTED;
	}

	/**
	 * Get the Test
	 * 
	 * @return The test
	 */
	public TestType getTest() {
		return test;
	}

	/**
	 * Get the name of the Agent that execute the test
	 * 
	 * @return Agent name
	 */
	public String getAgentName() {
		return agentName;
	}

	/**
	 * Set the name of the Agent that execute the test
	 * 
	 * @param agentName
	 */
	public void setAgentName(String agentName) {
		this.agentName = agentName;
	}

	/**
	 * Get the status of the test
	 * 
	 * @return Test Status
	 */
	public TestStatus getStatus() {
		return status;
	}

	/**
	 * Set the status of the test
	 * 
	 * @param status
	 *            The status to set
	 */
	public void setStatus(TestStatus status) {
		this.status = status;
	}

	/**
	 * Get the time that the test started
	 * 
	 * @return test start time
	 */
	public Date getStartTime() {
		return startTime;
	}

	/**
	 * Set the time that the test started
	 * 
	 * @param startTime
	 *            Test start time
	 */
	public void setStartTime(Date startTime) {
		this.startTime = startTime;
	}

	/**
	 * Get the time that the test finished
	 * 
	 * @return Test finished time
	 */
	public Date getEndTime() {
		return endTime;
	}

	/**
	 * Set the time that the test finished
	 * 
	 * @param endTime
	 *            Test finish time
	 */
	public void setEndTime(Date endTime) {
		this.endTime = endTime;
	}

	/**
	 * Whether there is waring in the test result
	 * 
	 * @return Whether there is waring in the test result
	 */
	public boolean isWarn() {
		return warn;
	}

	/**
	 * Set Whether there is waring in the test result
	 * 
	 * @param warn
	 *            Whether there is waring in the test result
	 */
	public void setWarn(boolean warn) {
		this.warn = warn;
	}

	/**
	 * Whether there is error in the test result
	 * 
	 * @return Whether there is error in the test result
	 */
	public boolean isError() {
		return error;
	}

	/**
	 * Set Whether there is error in the test result
	 * 
	 * @param error
	 *            Whether there is error in the test result
	 */
	public void setError(boolean error) {
		this.error = error;
	}

}
